package org.report4service.midlet;

import javax.microedition.lcdui.Display;
import javax.microedition.midlet.*;
import org.report4service.views.LoginForm;

/**
 * This is the main midlet entry point to the Report4Service mobile application
 * @author Jonathan
 */
public class Report4Service extends MIDlet {

    /** Midlet instance */
    private static Report4Service instance;
    /** Login view */
    private LoginForm loginForm;

    public Report4Service() {
        instance = this;
    }

    /**
     * @return the instance
     */
    public static Report4Service getInstance() {
        return instance;
    }

    public void startApp() {
        new LoginForm(getDisplay());
       // new SplashScreen(getDisplay());
    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
             notifyDestroyed();
    }

    public LoginForm getLoginForm() {
        return loginForm;
    }

    public void setLoginForm(LoginForm loginForm) {
        this.loginForm = loginForm;
    }

    /**
     * @param instance
     *            the instance to set
     */
    public static void setInstance(Report4Service instance) {
        Report4Service.instance = instance;
    }

    public static Display getDisplay() {
        return Display.getDisplay(instance);
    }

    public static void exitMIDlet() {
        getInstance().destroyApp(true);
    }
}
